package com.bitnpulse.dev2.jjh.engstudybook_free.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.net.Uri;

public class StudyDB extends SQLiteOpenHelper {
	
	
	private static final String DATABASE_NAME = "Study.db";//must modify db name 
	private static final int DATABASE_VERSION = 1;
	
	public  static final String TABLE_NAME = "Study_DB";
	
	public static final String _ID = "_id";
	public static final String CONTENT_ID				= "content_id";
	public static final String STUDY_1 				= "Study_1";
	public static final String STUDY_2 				= "Study_2";
	public static final String BOOKMARK 			= "Bookmark";
	
	public static final String[] FROM 	= {_ID , CONTENT_ID , STUDY_1 , STUDY_2 , BOOKMARK };
	public  String ORDER_BY = _ID+" DESC"; 
	
	public   final String TIME = "time";
	
	public StudyDB(Context context) {
	        super(context, DATABASE_NAME, null, DATABASE_VERSION);
	    }
	 
	 @Override
	    public void onCreate(SQLiteDatabase db) {
			db.execSQL("CREATE TABLE " 	+ TABLE_NAME 			
					+ " (" 
					+ _ID  							+ " INTEGER PRIMARY KEY AUTOINCREMENT," 
					+ CONTENT_ID				  	+ " TEXT," 
					+ STUDY_1				  		+ " TEXT," 
					+ STUDY_2						+ " TEXT,"
					+ BOOKMARK						+ " TEXT"
					+ ");");
	    }
	 
	 @Override
	    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	        db.execSQL("DROP TABLE IF EXISTS ListT");
	        onCreate(db);
	    }
}